package com.example.designpatterns.model.iterator;


/**
 * @author yanyun zhu
 * @version 1.0
 * @date 2022/1/6 17:48
 */
public class Demo {
    public static void main(String[] args) {
        ArrayList names = new ArrayList<>();
//        names.add("xzg");
//        names.add("wang");
//        names.add("zheng");
//        Iterator iterator = new ArrayIterator(names);

        Iterator iterator = names.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.currentItem());
            iterator.next();
        }
    }
}
